const path = require('path')
const HtmlPlugin = require('html-webpack-plugin');

PAGE_OPTIONS={
    template:path.join(__dirname, '../../', '/public/index.html')
}
exports.resolve = dir => {
    console.log( path.join(__dirname, '../../', dir || ''))
    return path.join(__dirname, '../../', dir || '')
}

exports.getPage=options => {
    const {
    //   title,
      name,
      chunks,
      template
    } = options
    return new HtmlPlugin(Object.assign({}, PAGE_OPTIONS, {
    //   title,
      chunks,
      template: template || PAGE_OPTIONS.template,
      filename: `${name}.html`
    }))
  }